#!/bin/bash


# Decompose the case
decomposePar

# Run the simulation in parallel and use pyFoamPlotRunner to generate plots
pyFoamPlotRunner.py mpirun -np 8 sonicFoam -parallel

# Reconstruct the case after simulation completion
reconstructPar

# Remove processor directories
rm -rf processor*

# Create the 'pyfoam' directory if it doesn't exist
mkdir -p pyfoam

# Move files starting with 'PyFoam' to the 'pyfoam' directory
mv PyFoam* pyfoam/ 2>/dev/null

# Move the 'Gnuplotting.analyzed' folder to the 'pyfoam' directory
mv Gnu* pyfoam/ 2>/dev/null

# Run parafoam
paraFoam
